<%@page import="org.proddevplm.dao.data.activities.Activity"%>
<%@page import="org.proddevplm.dao.data.stakeholders.Stakeholder"%>
<%@page import="java.util.List"%>
<%@page import="org.proddevplm.constants.ControllerConstants"%>
<%@page import="org.proddevplm.business.tools.constants.ToolsConstants" %>

<script>

	function loadMyReqsPageWithReq(request, page) {
	    $.post(request, function(data) {
	        $("#myRequirements").load(page);
	    });
	}
	
	$(function(){
		$("button").button();
	});
	
	function saveRequirement(){
		var requirement = document.getElementById('shRequirement').value;
		var description = document.getElementById('reqDescription').value;
		var activityName = $('#activitySelect').val();
		
		var arguments = "requirement="+requirement+"&description="+description+"&activityName="+activityName;
		ajaxCall("toolsManager", "7", arguments, clearData);
	}
	
	function clearData(data){
		alert('Requirement successfully added in the database');
		document.getElementById('shRequirement').value = null;
		document.getElementById('reqDescription').value = null;
	}
	
	function viewMyReqs(){
		$("#inputReq").hide();
		$("#myRequirements").show();
		loadMyReqsPageWithReq("/proddev/controller?manager=dataAccessManager&method=8", "content/project/devTools/workspace/needReqs/myRequirements.jsp");
	}

</script>


<%
	List<Activity> activitiesForUser = (List)session.getAttribute("activitiesForUser");
%>


<div style="width:100%;">

	<div class="containerSmall" id="inputReq" style="width:55%; float:left; text-align:left">
				
		<div style="margin-top:10px;">
			<b>Requirement:</b><br/>
			<i>please add one requirement then press the <b>Save requirement</b> button</i>
		</div>
				
		<div style="margin-top:5px; ">
			<input class="regInput" id="shRequirement" name="shRequirement" style="width:100%" />
		</div>
		
		<div style="margin-top:10px;">
			<b>Add a description of your requirement</b><br/>
			<i>briefly describe your expectations for this requirement</i>
		</div>
		<textarea class="regInput" id="reqDescription" name="reqDescription" rows="2" style="width:100%; margin-top:5px"></textarea>
		
		<div style="width:100%; margin-top:5px">	
			<button id="saveRequirement" name="saveRequirement" onclick="saveRequirement()" style="width:40%; font-weight:bold; float:left">Save requirement</button>
			<button id="viewMyReqs" name="viewMyReqs" onclick="viewMyReqs()" style="width:40%; font-weight:bold; float:right">View my requirements</button>
			<div style="clear:both"></div>
		</div>
		<div style="clear:both"></div>
	</div>
	
	<div style="clear:both;"></div>
	
	<div id="myRequirements" style="width:100%; margin-top:10px;">
		
	</div>
	
</div>
